unit UCadUsuEmpresa;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, UModeloFilha, StdCtrls, Mask, DBCtrls, Buttons, UDPTOUteis, DB,
  DBTables;

type
  TFCadUsuarioEmp = class(TFModeloFilha)
    dbedtEMPCODIGO: TDBEdit;
    EdRazao: TEdit;
    procedure dbedtEMPCODIGODblClick(Sender: TObject);
    procedure dbedtEMPCODIGOExit(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  FCadUsuarioEmp: TFCadUsuarioEmp;

implementation

uses UPesqEmpresa, UCadUsuarios;

{$R *.dfm}

procedure TFCadUsuarioEmp.dbedtEMPCODIGODblClick(Sender: TObject);
begin
  inherited;

   dbedtEMPCODIGO.Text := DPTOChamaPesquisa(FPesqEmpresa,TFPesqEmpresa,'EMPCODIGO', FCadUsuarios.QFilhaEmpresa, dbedtEMPCODIGO.Text);

end;

procedure TFCadUsuarioEmp.dbedtEMPCODIGOExit(Sender: TObject);
begin
  inherited;
  IF dbedtEMPCODIGO.Text <> '' then
    begin
      FCadUsuarios.qGenerica.Close;
      FCadUsuarios.qGenerica.SQL.Clear;
      FCadUsuarios.qGenerica.SQL.Add('select emprazaosocial from EMPRESA '
      + ' where EMPCODIGO = ' + QuotedStr(dbedtEMPCODIGO.Text));
      FCadUsuarios.qGenerica.Open;

      EdRazao.Text := FCadUsuarios.qGenerica.fieldByName('EMPRAZAOSOCIAL').AsString;

    end;

end;

end.
